import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import NewsView from '../views/NewsView.vue'
import NewsDetailView from '../views/NewsDetailView.vue'
import ParkListView from '../views/ParkListView.vue'
import ParkDetailView from '../views/ParkDetailView.vue'
import ProjectView from '../views/ProjectView.vue'
import ProjectDetailView from '../views/ProjectDetailView.vue'
import ProjectDockingView from '../views/ProjectDockingView.vue'
import ProjectDockingDetailView from '../views/ProjectDockingDetailView.vue'
import SignInView from '../views/SignInView.vue'
import SignUpView from '../views/SignUpView.vue'
import AccountView from '../views/mine/AccountView.vue'
import ProjectsView from '../views/mine/ProjectsView.vue'
import MineNewsView from '../views/mine/NewsView.vue'
import ParksView from '../views/mine/ParksView.vue'
const originalPush = VueRouter.prototype.push
 VueRouter.prototype.push = function push (location) { return originalPush.call(this, location).catch(err => err) }
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
    // params:{state:0}
  },
  {
    path: '/news/list',
    name: 'news-list',
    component: NewsView
  },
  {
    path: '/news/:id',
    name: 'news-detail',
    component: NewsDetailView
  },
  {
    path: '/yuanqu/list',
    name: 'yuanqu-list',
    component: ParkListView
  },
  {
    path: '/yuanqu/:id',
    name: 'yuanqu-detail',
    component: ParkDetailView
  },
  {
    path: '/project/docking',
    name: 'project-docking',
    component: ProjectDockingView
  },
  {
    path: '/project/docking/:id',
    name: 'project-docking-detail',
    component: ProjectDockingDetailView
  },
  {
    path: '/project/list',
    name: 'project-list',
    component: ProjectView
  },
  {
    path: '/project/:id',
    name: 'project-detail',
    component: ProjectDetailView
  },
  {
    path: '/signin',
    name: 'signin',
    component: SignInView
  },
  {
    path: '/signup',
    name: 'signup',
    component: SignUpView
  },
  {
    path: '/mine/account',
    name: 'AccountView',
    component: AccountView
  },
  {
    path: '/mine/projects',
    name: 'ProjectsView',
    component: ProjectsView
  },
  {
    path: '/mine/parks',
    name: 'ParksView',
    component: ParksView
  },
  {
    path: '/mine/news',
    name: 'MineNewsView',
    component: MineNewsView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/disclaimer',
    name: 'disclaimer',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/DisclaimerView.vue')
  },
  {
    path: '/user-agreement',
    name: 'UserAgreementView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/UserAgreementView.vue')
  },
  {
    path: '/product-and-service',
    name: 'ProductAndServiceView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/ProductAndServiceView.vue')
  },
  {
    path: '/conform',
    name: 'ConformView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/ConformView.vue')
  },
  {
    path: '/collect',
    name: 'CollectView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/CollectView.vue')
  },
  {
    path: '/forword',
    name: 'ForwordView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/ForwordView.vue')
  },
  {
    path: '/friend',
    name: 'FriendView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/FriendView.vue')
  },
  {
    path: '/singncode',
    name: 'SingnCode',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/SingnCodeView.vue')
  },
  {
    path: '/union',
    name: 'UnionView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/UnionView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass: 'nav-active'
})

export default router
